<template>
  <div class="community-box">
    <!-- 头部 -->
    <HeadNav :iconName="iconName" />

    <div class="community-block">
      <van-tabs v-model="active" title-active-color="red" @click="onClick">
        <van-tab title="全部"></van-tab>
        <van-tab title="好物测评"> </van-tab>
        <van-tab title="生活技能">内容 3</van-tab>
        <van-tab title="家常闲话">内容 4</van-tab>
      </van-tabs>
    </div>
    <router-view></router-view>
    <div style="height: 0.2rem"></div>
  </div>
</template>

<script>
import HeadNav from "../headNav/HeadNav";

export default {
  name: "Community",
  data() {
    return {
      iconName: "arrow-left",
      active: 1,
      pageNum: 1,
    };
  },
  components: {
    HeadNav,
  },
  mounted() {
    this.onClick(this.pageNum);
  },
  methods: {
    onClick(name) {
      this.pageNum = name;
      console.log(name);
      if (this.pageNum === 0) {
        this.$router.push("/all");
      }
      if (this.pageNum === 1) {
        this.$router.push("/appraisal");
      }
    },
  },
};
</script>



